import { Request, Response } from 'express';

const data = [
  {
    key: '1',
    firstLevel: '教书育人',
    secondLevel:
      '将“立德树人”为已任，教师形象好，能有意识的将“思政元素”有机融入课堂，注重对学生的正面引导',
    score: '5',
    fraction: 0,
  },
  {
    key: '2',
    firstLevel: 'Jim Green',
    score: '5',
    secondLevel: '教学目标符合大纲要求和学生实际，制定了授课计划；编写了教案',
    fraction: 0,
  },
  {
    key: '3',
    firstLevel: 'Joe Black',
    secondLevel: '关爱每位学生，对学生严格要求，耐心答疑',
    score: '5',
    fraction: 0,
  },
  {
    key: '4',
    firstLevel: 'Jim Red',
    secondLevel: '教师仪表整洁，遵守课堂教学礼仪和教学纪律，不迟到、早退，不做与教学无关的事情',
    score: '5',
    fraction: 0,
  },
  {
    key: '5',
    firstLevel: '教学内容',
    secondLevel: '教学目标明确、教学内容充实娴熟，讲解透彻，教学技能熟练，突出重点，讲清难点',
    score: '10',
    fraction: 0,
  },
  {
    key: '6',
    firstLevel: 'Jim Green',
    score: '10',
    secondLevel: '教学中能体现学术性、艺术性、思想性，理论联系实际，能介绍本学科发展的最新动态',
    fraction: 0,
  },
  {
    key: '7',
    firstLevel: 'Joe Black',
    secondLevel: '教学程序安排系统完整、层次分明；教学组织连贯有序，衔接自然，疏密有致',
    score: '10',
    fraction: 0,
  },
  {
    key: '8',
    firstLevel: 'Jim Red',
    secondLevel: '教学活动设计好、课堂气氛活跃，注重职业能力培养',
    score: '5',
    fraction: 0,
  },
  {
    key: '9',
    firstLevel: '教学方法',
    secondLevel: '教学方法灵活得当，教学过程中老师经常进行引导、指导、点评、激发学生的学习兴趣',
    score: '10',
    fraction: 0,
  },
  {
    key: '10',
    firstLevel: 'Jim Green',
    score: '10',
    secondLevel: '线上线下结合，能合理有效利用信息化教学手段及线上教学资源，有效提高课堂教学效率',
    fraction: 0,
  },
  {
    key: '11',
    firstLevel: 'Joe Black',
    secondLevel: '根据教学内容不同灵活采用适当的教学手段和工具，重视引导学生将知识转换为技能',
    score: '5',
    fraction: 0,
  },
  {
    key: '12',
    firstLevel: '教学效果',
    secondLevel: '完成教学任务，达到教学目的，时间分配得当',
    score: '5',
    fraction: 0,
  },
  {
    key: '13',
    firstLevel: 'John Brown',
    secondLevel:
      '教与学有机配合，教师循循善诱、科学指导。课堂气氛活跃而有序，学生积极思考、学习主动',
    score: '8',
    fraction: 0,
  },
  {
    key: '14',
    firstLevel: 'Jim Green',
    score: '7',
    secondLevel: '课堂练习、作业完成率、正确率较高',
    fraction: 0,
  },
];

type TeacherInfoNames = {
  number: string;
  userName: string;
  academicTitle: string;
};

type TeacherInfoCourses = {
  number: string;
  nature: string;
  credit: number;
  period: number;
  courseName: string;
};

type TeacherInfo = {
  semesters: Array<number>;
  names: Array<TeacherInfoNames>;
  schoolYears: Array<number>;
  courses: Array<TeacherInfoCourses>;
};

type TeacherInfoType = {
  status: string;
  info: TeacherInfo;
};

export default {
  'GET /api/teacherInfo': async (req: Request, res: Response) => {
    console.log('请求已经发送 /api/teacherInfo');
    const responseBody: TeacherInfoType = {
      status: 'ok',
      info: {
        semesters: [1, 2, 3],
        names: [
          { userName: 'jack', number: '00001', academicTitle: '教授' },
          { userName: 'Lucy', number: '00002', academicTitle: '副教授' },
          { userName: 'alice', number: '00003', academicTitle: '教授' },
        ],
        schoolYears: [2018, 2019, 2020, 2021],
        courses: [
          { courseName: 'Java', number: '060220301', nature: '理论课', credit: 4, period: 60 },
          {
            courseName: 'JavaScript',
            number: '060220302',
            nature: '实操课',
            credit: 5,
            period: 70,
          },
          { courseName: 'MySQL', number: '060220303', nature: '理论课', credit: 6, period: 80 },
        ],
      },
    };
    res.send(responseBody);
  },
  'GET /api/quotaInfo': async (req: Request, res: Response) => {
    console.log('请求已经发送 /api/quotaInfo');
    res.send({
      status: 'ok',
      data,
    });
  },
  'POST /api/saveTeachingEvaluationResult': async (req: Request, res: Response) => {
    console.log('请求已经发送 /api/saveQuotaData');
    console.log('req.body: ', req.body);
    res.send({
      status: 'ok',
    });
  },
  'GET /api/schoolYears': async (req: Request, res: Response) => {
    console.log('请求已经发送 /api/schoolYears');
    console.log('请求体数据 : ', req.body);
    res.send({
      status: 'ok',
      semesters: [1, 2, 3],
      schoolYears: [2018, 2019, 2020, 2021],
    });
  },
  'GET /api/teacherTeachingEvaluation': async (req: Request, res: Response) => {
    console.log('请求已经发送 /api/teacherTeachingEvaluation');
    console.log('请求体数据 : ', req.body);
    res.send({
      status: 'ok',
      results: [
        {
          key: '1',
          number: 1,
          courseName: 'Java',
          studentEvaluate: 87.8,
          teacherEvaluate: 89.6,
          supervisorEvaluate: 90.1,
        },
        {
          key: '2',
          number: 2,
          courseName: 'JavaScript',
          studentEvaluate: 90.5,
          teacherEvaluate: 91.6,
          supervisorEvaluate: 93.5,
        },
      ],
      syntheticalEvaluate: {
        average: 88.7,
        collegesRank: 12,
        evaluateResult: '良好',
      },
    });
  },
  'GET /api/collegesResult': async (req: Request, res: Response) => {
    console.log('请求已经发送 /api/teacherTeachingEvaluation');
    console.log('请求体数据 : ', req.body);
    res.send({
      status: 'ok',
      data: [
        {
          key: '1',
          userNumber: '05013001',
          userName: '张胜男',
          syntheticalEvaluate: 89.5,
          evaluateResult: '良好',
          collegesRank: 10,
        },
        {
          key: '2',
          userNumber: '05013002',
          userName: '李丽',
          syntheticalEvaluate: 90.5,
          evaluateResult: '优秀',
          collegesRank: 5,
        },
        {
          key: '3',
          userNumber: '05013003',
          userName: '王凯',
          syntheticalEvaluate: 81.4,
          evaluateResult: '中等',
          collegesRank: 20,
        },
        {
          key: '4',
          userNumber: '05013004',
          userName: '孙力',
          syntheticalEvaluate: 86.3,
          evaluateResult: '良好',
          collegesRank: 15,
        },
        {
          key: '5',
          userNumber: '05013005',
          userName: '张明明',
          syntheticalEvaluate: 87.7,
          evaluateResult: '良好',
          collegesRank: 12,
        },
      ],
    });
  },
};
